Skip to content

Extract multipart header-size validation into a method - #371

Closed
Kludex wants to merge 1 commit into
mainfrom
extract-multipart-header-size-check
Closed

Kludex wants to merge 1 commit into
mainfrom
extract-multipart-header-size-check

Conversation

@Kludex

@Kludex Kludex commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

Replace the advance_header_size closure with inline counter increments and a shared _check_header_size(size, offset) method. This keeps i and current_header_size as ordinary locals without duplicating validation or changing when errors are raised.

This targets main after #370, independently of #369. Callback handling and workflows are unchanged. Use the existing CodSpeed benchmarks to check whether this isolated change improves performance; no speedup is assumed.

Add public-API tests for limits in header names, leading spaces, and values, including exact limits, split writes, error offsets, and size-check-before-validation ordering. The new cases also pass against unchanged main.

Validation on Python 3.13.18: scripts/check, scripts/test --strict-config --strict-markers (201 tests, 100% coverage), and scripts/rename pass.

Session: pi --session 01a1e0a2-78a9-7473-86ce-b992bd92cf74

View guided diff

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-16T09:13:55.227208Z 16601d7 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

View guided diff | Re-trigger cubic

@codspeed

codspeed Bot commented Nov 16, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 5 untouched benchmarks


Comparing extract-multipart-header-size-check (16601d7) with main (89a8013)

Open in CodSpeed

@Kludex

Kludex commented Nov 16, 2026

Copy link
Copy Markdown
Owner Author

Closing because CodSpeed did not confirm a performance improvement for the helper version. The inlined variant was not pushed or measured in CI, so no speedup is established for it.

@Kludex Kludex closed this Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant